package com.aaa.member.service.impl;

import com.aaa.member.entity.IntegrationHistory;
import com.aaa.member.mapper.IntegrationHistoryMapper;
import com.aaa.member.service.IntegrationHistoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (IntegrationHistory)表服务实现类
 *
 * @author chenhao
 * @since 2020-11-19 17:15:59
 */
@Service("integrationHistoryService")
public class IntegrationHistoryServiceImpl implements IntegrationHistoryService {
    @Resource
    private IntegrationHistoryMapper integrationHistoryMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public IntegrationHistory queryById(Long id) {
        return this.integrationHistoryMapper.queryById (id);
    }

    /**
     * 查询指定行数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<IntegrationHistory> queryAllByLimit(int offset, int limit) {
        return this.integrationHistoryMapper.queryAllByLimit (offset, limit);
    }

    /**
     * 通过实体作为筛选条件查询
     *
     * @param integrationHistory 实例对象
     * @return 对象列表
     */
    @Override
    public List<IntegrationHistory> queryAll(IntegrationHistory integrationHistory) {
        return this.integrationHistoryMapper.queryAll (integrationHistory);
    }

    /**
     * 新增数据
     *
     * @param integrationHistory 实例对象
     * @return 实例对象
     */
    @Override
    public IntegrationHistory insert(IntegrationHistory integrationHistory) {
        this.integrationHistoryMapper.insert (integrationHistory);
        return integrationHistory;
    }

    /**
     * 修改数据
     *
     * @param integrationHistory 实例对象
     * @return 实例对象
     */
    @Override
    public IntegrationHistory update(IntegrationHistory integrationHistory) {
        this.integrationHistoryMapper.update (integrationHistory);
        return this.queryById (integrationHistory.getId ( ));
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.integrationHistoryMapper.deleteById (id) > 0;
    }
}